<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: SoundGenerator Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 Display Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classfabgl_1_1_sound_generator.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classfabgl_1_1_sound_generator-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">SoundGenerator Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><a class="el" href="classfabgl_1_1_sound_generator.html" title="SoundGenerator handles audio output. ">SoundGenerator</a> handles audio output.  
 <a href="classfabgl_1_1_sound_generator.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="soundgen_8h_source.html">soundgen.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad042bca5fcafcc3ee71a3a447978c88b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_ad042bca5fcafcc3ee71a3a447978c88b.html#ad042bca5fcafcc3ee71a3a447978c88b">SoundGenerator</a> (int sampleRate=DEFAULT_SAMPLE_RATE)</td></tr>
<tr class="memdesc:ad042bca5fcafcc3ee71a3a447978c88b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an instance of the sound generator. Only one instance is allowed.  <a href="classfabgl_1_1_sound_generator_ad042bca5fcafcc3ee71a3a447978c88b.html#ad042bca5fcafcc3ee71a3a447978c88b">More...</a><br /></td></tr>
<tr class="separator:ad042bca5fcafcc3ee71a3a447978c88b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04178c4d1679101843945ecfe8c8d3e1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_a04178c4d1679101843945ecfe8c8d3e1.html#a04178c4d1679101843945ecfe8c8d3e1">attach</a> (<a class="el" href="classfabgl_1_1_waveform_generator.html">WaveformGenerator</a> *value)</td></tr>
<tr class="memdesc:a04178c4d1679101843945ecfe8c8d3e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attaches a waveform generator.  <a href="classfabgl_1_1_sound_generator_a04178c4d1679101843945ecfe8c8d3e1.html#a04178c4d1679101843945ecfe8c8d3e1">More...</a><br /></td></tr>
<tr class="separator:a04178c4d1679101843945ecfe8c8d3e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac8bb3912a3ce86b15842e79d0b421204"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_ac8bb3912a3ce86b15842e79d0b421204.html#ac8bb3912a3ce86b15842e79d0b421204">clear</a> ()</td></tr>
<tr class="memdesc:ac8bb3912a3ce86b15842e79d0b421204"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stops playing and removes all attached waveform generators.  <a href="classfabgl_1_1_sound_generator_ac8bb3912a3ce86b15842e79d0b421204.html#ac8bb3912a3ce86b15842e79d0b421204">More...</a><br /></td></tr>
<tr class="separator:ac8bb3912a3ce86b15842e79d0b421204"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15a8d9231086fe5e0cec746e00b87144"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_a15a8d9231086fe5e0cec746e00b87144.html#a15a8d9231086fe5e0cec746e00b87144">detach</a> (<a class="el" href="classfabgl_1_1_waveform_generator.html">WaveformGenerator</a> *value)</td></tr>
<tr class="memdesc:a15a8d9231086fe5e0cec746e00b87144"><td class="mdescLeft">&#160;</td><td class="mdescRight">Detaches a waveform generator.  <a href="classfabgl_1_1_sound_generator_a15a8d9231086fe5e0cec746e00b87144.html#a15a8d9231086fe5e0cec746e00b87144">More...</a><br /></td></tr>
<tr class="separator:a15a8d9231086fe5e0cec746e00b87144"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa7c56b84cb4738b6826e34ca20993d62"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_aa7c56b84cb4738b6826e34ca20993d62.html#aa7c56b84cb4738b6826e34ca20993d62">play</a> (bool value)</td></tr>
<tr class="memdesc:aa7c56b84cb4738b6826e34ca20993d62"><td class="mdescLeft">&#160;</td><td class="mdescRight">Starts or stops playing.  <a href="classfabgl_1_1_sound_generator_aa7c56b84cb4738b6826e34ca20993d62.html#aa7c56b84cb4738b6826e34ca20993d62">More...</a><br /></td></tr>
<tr class="separator:aa7c56b84cb4738b6826e34ca20993d62"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88c86d325a9e0c70437469be339f65ee"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_a88c86d325a9e0c70437469be339f65ee.html#a88c86d325a9e0c70437469be339f65ee">playing</a> ()</td></tr>
<tr class="memdesc:a88c86d325a9e0c70437469be339f65ee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determines whether sound generator is playing.  <a href="classfabgl_1_1_sound_generator_a88c86d325a9e0c70437469be339f65ee.html#a88c86d325a9e0c70437469be339f65ee">More...</a><br /></td></tr>
<tr class="separator:a88c86d325a9e0c70437469be339f65ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ba0033bdfb41d5d58fc63a160f311f6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classfabgl_1_1_samples_generator.html">SamplesGenerator</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_a7ba0033bdfb41d5d58fc63a160f311f6.html#a7ba0033bdfb41d5d58fc63a160f311f6">playSamples</a> (int8_t const *<a class="el" href="displaycontroller_8h_a96db82e580e46e24e2b39dd6c5bf7c21.html#a96db82e580e46e24e2b39dd6c5bf7c21">data</a>, int length, int <a class="el" href="classfabgl_1_1_sound_generator_a56fd55a21e8060769938c33ac16ee4f2.html#a56fd55a21e8060769938c33ac16ee4f2">volume</a>=100, int durationMS=0)</td></tr>
<tr class="memdesc:a7ba0033bdfb41d5d58fc63a160f311f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plays the specified samples.  <a href="classfabgl_1_1_sound_generator_a7ba0033bdfb41d5d58fc63a160f311f6.html#a7ba0033bdfb41d5d58fc63a160f311f6">More...</a><br /></td></tr>
<tr class="separator:a7ba0033bdfb41d5d58fc63a160f311f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9e699f42faf36a58fc0f2ce0b014d39"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ab9e699f42faf36a58fc0f2ce0b014d39"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_ab9e699f42faf36a58fc0f2ce0b014d39.html#ab9e699f42faf36a58fc0f2ce0b014d39">playSound</a> (T const &amp;waveform, int frequency, int durationMS, int <a class="el" href="classfabgl_1_1_sound_generator_a56fd55a21e8060769938c33ac16ee4f2.html#a56fd55a21e8060769938c33ac16ee4f2">volume</a>=100)</td></tr>
<tr class="memdesc:ab9e699f42faf36a58fc0f2ce0b014d39"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plays the specified waveform.  <a href="classfabgl_1_1_sound_generator_ab9e699f42faf36a58fc0f2ce0b014d39.html#ab9e699f42faf36a58fc0f2ce0b014d39">More...</a><br /></td></tr>
<tr class="separator:ab9e699f42faf36a58fc0f2ce0b014d39"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a77a669d4f95b8abf529a7d3183acb432"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_a77a669d4f95b8abf529a7d3183acb432.html#a77a669d4f95b8abf529a7d3183acb432">setVolume</a> (int value)</td></tr>
<tr class="memdesc:a77a669d4f95b8abf529a7d3183acb432"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the overall volume.  <a href="classfabgl_1_1_sound_generator_a77a669d4f95b8abf529a7d3183acb432.html#a77a669d4f95b8abf529a7d3183acb432">More...</a><br /></td></tr>
<tr class="separator:a77a669d4f95b8abf529a7d3183acb432"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56fd55a21e8060769938c33ac16ee4f2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfabgl_1_1_sound_generator_a56fd55a21e8060769938c33ac16ee4f2.html#a56fd55a21e8060769938c33ac16ee4f2">volume</a> ()</td></tr>
<tr class="memdesc:a56fd55a21e8060769938c33ac16ee4f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determines current overall volume.  <a href="classfabgl_1_1_sound_generator_a56fd55a21e8060769938c33ac16ee4f2.html#a56fd55a21e8060769938c33ac16ee4f2">More...</a><br /></td></tr>
<tr class="separator:a56fd55a21e8060769938c33ac16ee4f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classfabgl_1_1_sound_generator.html" title="SoundGenerator handles audio output. ">SoundGenerator</a> handles audio output. </p>
<p>Applications attach waveform generators (like <a class="el" href="classfabgl_1_1_sine_waveform_generator.html" title="Sine waveform generator. ">SineWaveformGenerator</a>, <a class="el" href="classfabgl_1_1_square_waveform_generator.html" title="Square waveform generator. ">SquareWaveformGenerator</a>, etc...) and call <a class="el" href="classfabgl_1_1_sound_generator_aa7c56b84cb4738b6826e34ca20993d62.html#aa7c56b84cb4738b6826e34ca20993d62" title="Starts or stops playing. ">SoundGenerator.play()</a> to start audio generation.</p>
<p>The GPIO used for audio output is GPIO-25. See <a class="el" href="conf_audio.html">Configuring Audio port</a> for audio connection sample schema.</p>
<p>Here is a list of supported sound generators:</p><ul>
<li><a class="el" href="classfabgl_1_1_sine_waveform_generator.html" title="Sine waveform generator. ">SineWaveformGenerator</a></li>
<li><a class="el" href="classfabgl_1_1_square_waveform_generator.html" title="Square waveform generator. ">SquareWaveformGenerator</a></li>
<li><a class="el" href="classfabgl_1_1_triangle_waveform_generator.html" title="Triangle waveform generator. ">TriangleWaveformGenerator</a></li>
<li><a class="el" href="classfabgl_1_1_sawtooth_waveform_generator.html" title="Sawtooth waveform generator. ">SawtoothWaveformGenerator</a></li>
<li><a class="el" href="classfabgl_1_1_noise_waveform_generator.html" title="Noise generator. ">NoiseWaveformGenerator</a></li>
<li><a class="el" href="classfabgl_1_1_v_i_c_noise_generator.html" title="Emulates VIC6561 (VIC20) noise generator. ">VICNoiseGenerator</a></li>
<li><a class="el" href="classfabgl_1_1_samples_generator.html" title="Samples generator. ">SamplesGenerator</a> </li>
</ul>

<p class="definition">Definition at line <a class="el" href="soundgen_8h_source.html#l00337">337</a> of file <a class="el" href="soundgen_8h_source.html">soundgen.h</a>.</p>
</div><hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="soundgen_8h_source.html">soundgen.h</a></li>
<li><a class="el" href="soundgen_8cpp_source.html">soundgen.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>fabgl</b></li><li class="navelem"><a class="el" href="classfabgl_1_1_sound_generator.html">SoundGenerator</a></li>
    <li class="footer">Generated on Wed Dec 9 2020 16:48:31 for FabGL by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
